home *** CD-ROM | disk | FTP | other *** search
/ Pocket PC Game Programming / Pocket PC Game Programming.iso / source.exe / CH15 / Project01 / CBitmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-30  |  1.4 KB  |  55 lines

  1. //////////////////////////////////////////////////////////////////////
  2. // Pocket PC Game Programming
  3. // Chapter 9: Sprites and Animation
  4. //
  5. // CBitmap Header File
  6. //
  7. // This file includes the CBitmap class definition.
  8. //
  9. //////////////////////////////////////////////////////////////////////
  10.  
  11. #pragma once
  12.  
  13. class CBitmap
  14. {
  15. protected:
  16.     HDC hScreenDC;
  17.     LPBYTE lpDIB;
  18.     LPBYTE lpSourceBits;
  19.     LPBITMAPINFO lpbmi;
  20.     DWORD dwImageSize;
  21.     BITMAP bmBitmap;
  22.     LPTSTR lpBitmapFN;
  23.     HDC hSourceDC;
  24.     HBITMAP hOldBitmap;
  25.  
  26.     BOOL LoadDIB(LPCTSTR szFileName);
  27.     LPSTR BitmapDataIndex(LPSTR lpbi);
  28.     int PaletteSize(LPSTR lpbi);
  29.     int BytesPerLine(LPBITMAPINFOHEADER lpBMIH);
  30.  
  31. public:
  32.     CBitmap() { };
  33.     CBitmap(HDC hdc);
  34.     virtual ~CBitmap();
  35.     virtual HDC GetSourceDC() { return hSourceDC; };
  36.     virtual BOOL BitBlit(HDC hdc, int x, int y);
  37.     virtual BOOL BitBlit(int x, int y);
  38.     virtual BOOL StretchBlit(int x, int y, int dx, int dy);
  39.     virtual BOOL TransBlit(int x, int y, COLORREF clrTrans);
  40.  
  41.     LPTSTR GetFilename() { return lpBitmapFN; };
  42.     void SetFilename(LPTSTR lpFN) { lpBitmapFN = lpFN; };
  43.     HDC GetScreenDC() { return hScreenDC; };
  44.     void SetScreenDC(HDC hNew) { hScreenDC = hNew; };
  45.  
  46.     BOOL Create(int Width, int Height);
  47.     BOOL Load(LPTSTR lpFilename);
  48.     int BitCount();
  49.     virtual int ImageWidth();
  50.     virtual int ImageHeight();
  51.     int NumPlanes();
  52.  
  53. };
  54.  
  55.